#include "searchbutton.h"
#include "QPropertyAnimation"
#include "QBitmap"
#include "QPushButton"
#include "ui_mainwindow.h"
SearchButton::SearchButton(QWidget* p,QPoint init):
    QPushButton(p)
{
    this->p = p;
    this->move(init);
    QPixmap pix(":/new/prefix1/search.png");
    pix = pix.scaled(50,50,Qt::KeepAspectRatio,Qt::SmoothTransformation);
    this->resize(pix.size());
    this->setMask(QBitmap(pix.mask()));
    setStyleSheet("QPushButton{border-image: url(:/new/prefix1/search.png);}");
}
void SearchButton::MoveAni(QPoint next){//移动动画
    pPosAnimation1 = new QPropertyAnimation(this, "pos",p);
    pPosAnimation1->setDuration(1000);
    pPosAnimation1->setStartValue(this->pos());
    pPosAnimation1->setEndValue(next);
    pPosAnimation1->setEasingCurve(QEasingCurve::InOutQuad);
    pPosAnimation1->start();
    move(next);
}
